package cloud.xlh.auth.service.impl;

import cloud.xlh.auth.service.*;
import cloud.xlh.infrastructure.utils.JSONObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/2/8 10:08
 * @ Description:
 */
@Service
public class VerifyServiceImpl implements VerifyService {
    @Autowired
    private UserSecurityService userSecurityService;

    @Override
    public boolean verifyToken(JSONObject jsonObject) {
        TokenService tokenService = userSecurityService.getTokenService();
        return tokenService.checkToken(jsonObject);
    }

    @Override
    public JSONObject sendMessage(JSONObject jsonObject) {
        MessageService messageService = userSecurityService.getMessageService();
        CommonService commonService = userSecurityService.getCommonService();
        JSONObject userInfoBOJsonObject = JSONObjectUtil.javaObjectToJSONObject(jsonObject);
        if (commonService.verifyUser(userInfoBOJsonObject)) {

        } else {

        }
        messageService.doSendMessage();
        /**
           存二级缓存
         **/
        return null;
    }
}
